Home | History | Annotate | Download | only in include
      1 /**************************************************************************
      2 *
      3 * Copyright (c) 2000 Microsoft Corporation
      4 *
      5 * Module Name:
      6 *
      7 *   Gdiplus init
      8 *
      9 * Abstract:
     10 *
     11 *   GDI+ startup/shutdown API's
     12 *
     13 * Created:
     14 *
     15 *   09/02/2000 agodfrey
     16 *      Created it.
     17 *
     18 **************************************************************************/
     19 
     20 #ifndef _GDIPLUSINIT_H
     21 #define _GDIPLUSINIT_H
     22 //************************************************************************
     23 #if _FX_COMPILER_ == _FX_VC6_
     24 typedef unsigned long ULONG_PTR, *PULONG_PTR;    //johnson add here.
     25 #endif
     26 //************************************************************************
     27 
     28 // Used for debug event notification (debug builds only)
     29 
     30 enum DebugEventLevel
     31 {
     32     DebugEventLevelFatal,
     33     DebugEventLevelWarning
     34 };
     35 
     36 // Callback function that GDI+ can call, on debug builds, for assertions
     37 // and warnings.
     38 
     39 typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message);
     40 
     41 // Notification functions which the user must call appropriately if
     42 // "SuppressBackgroundThread" (below) is set.
     43 
     44 typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token);
     45 typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token);
     46 
     47 // Input structure for GdiplusStartup()
     48 
     49 struct GdiplusStartupInput
     50 {
     51     UINT32 GdiplusVersion;             // Must be 1
     52     DebugEventProc DebugEventCallback; // Ignored on free builds
     53     BOOL SuppressBackgroundThread;     // FALSE unless you're prepared to call
     54                                        // the hook/unhook functions properly
     55     BOOL SuppressExternalCodecs;       // FALSE unless you want GDI+ only to use
     56                                        // its internal image codecs.
     57 
     58     GdiplusStartupInput(
     59         DebugEventProc debugEventCallback = NULL,
     60         BOOL suppressBackgroundThread = FALSE,
     61         BOOL suppressExternalCodecs = FALSE)
     62     {
     63         GdiplusVersion = 1;
     64         DebugEventCallback = debugEventCallback;
     65         SuppressBackgroundThread = suppressBackgroundThread;
     66         SuppressExternalCodecs = suppressExternalCodecs;
     67     }
     68 };
     69 
     70 // Output structure for GdiplusStartup()
     71 
     72 struct GdiplusStartupOutput
     73 {
     74     // The following 2 fields are NULL if SuppressBackgroundThread is FALSE.
     75     // Otherwise, they are functions which must be called appropriately to
     76     // replace the background thread.
     77     //
     78     // These should be called on the application's main message loop - i.e.
     79     // a message loop which is active for the lifetime of GDI+.
     80     // "NotificationHook" should be called before starting the loop,
     81     // and "NotificationUnhook" should be called after the loop ends.
     82 
     83     NotificationHookProc NotificationHook;
     84     NotificationUnhookProc NotificationUnhook;
     85 };
     86 
     87 // GDI+ initialization. Must be called before GDI+ API's are used.
     88 //
     89 // token  - may not be NULL - accepts a token to be passed in the corresponding
     90 //          GdiplusShutdown call.
     91 // input  - may not be NULL
     92 // output - may be NULL only if input->SuppressBackgroundThread is FALSE.
     93 
     94 extern "C" Status WINAPI GdiplusStartup(
     95     OUT ULONG_PTR *token,
     96     const GdiplusStartupInput *input,
     97     OUT GdiplusStartupOutput *output);
     98 
     99 // GDI+ termination. Must be called before GDI+ is unloaded. GDI+ API's may not
    100 // be called after this.
    101 
    102 extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);
    103 
    104 #endif
    105